#!/bin/sh

#######################################################################
#
# pgAdmin III - PostgreSQL Tools
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
# stringmerge - merge pgadmin3.pot template file into existing pgadmin3.po
# translated files, compile and publish them on CVS.
#
# Same as 'Update from .pot' feature of poEdit.
#
#######################################################################

if test -f pgadmin3.pot; then

  git pull
  for GETTEXTDIR in i18n/??_?? ; do
  	echo "Entering $GETTEXTDIR."
    cd $GETTEXTDIR
    echo "Updating from SVN."
    echo "Merging pgadmin3.pot into pgadmin3.po"
    msgmerge --update pgadmin3.po ../../pgadmin3.pot
    git add pgadmin3.po pgadmin3.mo
    cd ../..
  done
  cd i18n
  echo "Committing changes to SVN."
  git commit -m "Automatic merge using stringmerge script." 
fi
